package com.jcx.ldzj.utile;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBCUtile
{

    private static String URL = "jdbc:mysql://47.106.228.42:3306/workflow?useUnicode=true&useSSL=false&characterEncoding=utf8&allowPublicKeyRetrieval=true&&serverTimezone=UTC";
    private static String UNAME = "root";
    private static String PWD = "root";

    private static Connection conn = null;
    public static void setUrl(String url){
        URL=url;
    }
    public static void setUNAME(String uname){
        UNAME=uname;
    }
    public static void setPWD(String pwd){
        PWD=pwd;
    }

    public static Connection connecTionJDBC()
    {
        try
        {
            // 1.加载驱动程序
            Class.forName("com.mysql.cj.jdbc.Driver");
            // 2.获得数据库的连接
            conn = DriverManager.getConnection(URL, UNAME, PWD);
        }
        catch (ClassNotFoundException e)
        {
            e.printStackTrace();
        }
        catch (SQLException  e)
        {
            e.printStackTrace();
        }
        return conn;
    }


}